package com.uni.web.util;

import java.text.SimpleDateFormat;

/**
 * 生成一个不重复的KEY
 * 
 * @author cai
 *
 */
public class KeyUtils {
	public static String WECHAT = "1001";

	public static String ORDER = "01";
	public static String REFUND = "02";
	public static String WITHDRAW = "03";

	private KeyUtils() {
	}

	public static String getKey() {
		SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
		String dateStr = dateformat.format(System.currentTimeMillis());
		return dateStr + (long) (Math.random() * 10000000L);
	}

	public static Long getLongKey() {
		return Long.valueOf(getKey());
	}

	public static String getWxOrderKey() {
		return WECHAT + ORDER + getKey();
	}

	public static String getWxRefundKey() {
		return WECHAT + REFUND + getKey();
	}

	public static String getWxWithdrawKey() {
		return WECHAT + WITHDRAW + getKey();
	}
	
	public static void main(String[] args) {
		System.out.println(Math.random());
	}
}
